<template>
	<rx-dialog @handOk="handleSubmit" @cancel="cancel">
		<rx-layout>
			<div slot="center">
				<a-form-model :model="dimensionConf">
					<a-row>
						<a-col :span="12">
							<a-form-model-item :label="i18n('form.fieldRemarks','字段备注')" style="width:85%">
								{{dimensionConf.fieldLabel}}
							</a-form-model-item>
						</a-col>
						<a-col :span="12">
							<a-form-model-item :label="i18n('form.dataFormat','数据格式')">
								<a-select style="width:100%" v-model="dimensionConf.dataFormat" :getPopupContainer="p=>p.parentNode">
									<a-select-option value="YYYY-MM-DD">YYYY-MM-DD</a-select-option>
									<a-select-option value="YYYY-MM-DD HH:mm:ss">YYYY-MM-DD HH:mm:ss</a-select-option>
									<a-select-option value="YYYY/MM/DD">YYYY/MM/DD</a-select-option>
									<a-select-option value="YYYY/MM/DD HH:mm:ss">YYYY/MM/DD HH:mm:ss</a-select-option>
								</a-select>
							</a-form-model-item>
						</a-col>
					</a-row>
					<a-row>
						<a-col :span="24">
							<a-form-model-item :label="i18n('form.sort','排序')">
								<a-radio-group v-model="dimensionConf.sort">
									<a-radio value="default">{{i18n('form.default','默认')}}</a-radio>
									<a-radio value="DESC">{{i18n('form.desOrder','降序')}}(DESC)</a-radio>
									<a-radio value="ASC">{{i18n('form.ascOrder','升序')}}(ASC)</a-radio>
								</a-radio-group>
							</a-form-model-item>
						</a-col>
					</a-row>
				</a-form-model>
			</div>
		</rx-layout>
	</rx-dialog>
</template>

<script>
import {Util,RxLayout,RxDialog} from "@lowcode/jpaas-common-lib";

export default {
	name: "DateSetting",
	props:['layerid','destroy','lydata',"dimension"],
	components:{
		RxLayout,
		RxDialog
	},
	data() {
		return {
			dimensionConf:{
				fieldLabel:"",
				dataFormat:"YYYY-MM-DD",
				sort:"default",
			}
		}
	},
	created() {
		if(this.dimension){
			this.dimensionConf=Object.assign(this.dimensionConf,this.dimension);
		}
	},
	methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "formChartDef", key);
        },
		handleSubmit() {
			Util.closeWindow(this, "ok",this.dimensionConf);
		},
		cancel() {
			Util.closeWindow(this, "cancel");
		},
	},
	watch: {}
}
</script>

<style scoped>
</style>